/*
 * Libbzr.h
 *
 *  Created on: 19/10/2013
 *      Author: asc
 */

#ifndef LIBBZR_H_
#define LIBBZR_H_

#include "RepoTemplate/RepoTemplate.h"
#include "utils/utils.h"
#include <string>
#include <libxml++/libxml++.h>
#include <iostream>
#include <exception>
#include <locale>

/* GRAMMAR WAY */
#include <fstream>
#include <libbzr/Libbzr.hh>

using namespace std;

namespace Libbzr {

	enum keys_bzr{logs=1, log, revno, committer, branchnick, timestamp, message, affectedfiles, renamed, modified, added, removed, file, directory, merge};
	map<string,keys_bzr> resolv_key_bzr =
	{
			{"logs"				,logs},
			{"log"				,log},
			{"revno"			,revno},
			{"committer"		,committer},
			{"branch-nick"		,branchnick},
			{"timestamp"		,timestamp},
			{"message"			,message},
			{"affected-files"	,affectedfiles},
			{"renamed"			,renamed},
			{"modified"			,modified},
			{"added"			,added},
			{"removed"			,removed},
			{"file"				,file},
			{"directory"		,directory},
			{"merge"			,merge}
	};


	class Libbzr: public RepoTemplate
	{
	public:
		Libbzr();
		Libbzr(string fileName);
		virtual ~Libbzr();
		void read();

	private:
		void parseSubTree(xmlpp::TextReader &reader);
		void parse();
		void parseGrammar();
	};

}  // namespace libbzr

#endif /* LIBBZR_H_ */
